<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: 'App',
  components: {

  },
  data () {
    return {

    }
  },
  mounted () {
    this.getUser();
    this.getCartCount();
  },
  methods:{
    getUser(){
      this.axios.get('/user').then((res={})=>{
        //to-do 保存到vuex里面
        this.$store.dispatch('saveUserName',res.username);
      })
    },
    getCartCount(){
      this.axios.get('/cart/products/sum').then((res=0)=>{
        //to-do 保存到vuex里面
        this.$store.dispatch('saveCartCount',res);
      })
    }
  }
}
</script>

<style lang="scss">
@import "./assets/reset.scss";
@import "./assets/config.scss";
@import "./assets/button.scss";
</style>
